<?php
	$monthNames = false;
	if(isset($_SESSION["language"]["month_names"]) && $_SESSION["language"]["month_names"] != "")
	{
		$monthNames = json_decode($_SESSION["language"]["month_names"], true);
	}
	foreach($events as $event): ?>

		<div class="eventsHolder">
			<div class="event">
				<a href="<?php echo $site_pages["events"]["url"].$event["url"]; ?>.html" title="<?php echo $event["name"]?>"><?php echo $event["name"]?></a>
				<?php
					$shortDescription = summarize_description($event["description"], 250);
				?>
				<p><?php echo $shortDescription; ?></p>
				<?php
					if($monthNames)
					{
						$startMonth = $monthNames[date("n", $event["start_date"])];
						$endMonth = $monthNames[date("n", $event["end_date"])];
					}
					else
					{
						$startMonth = date("F", $event["start_date"]);
						$endMonth = date("F", $event["end_date"]);
					}
					
					$startDate = date("d", $event["start_date"]) . " " . $startMonth . " " . date("Y", $event["start_date"]);
					$endDate = date("d", $event["end_date"]) . " " . $endMonth . " " . date("Y", $event["end_date"]);
					
					$city = false;
					if($event["city_id"] > 0)
					{
						$city = $connection->fetch_row("cities", $event["city_id"], "id");
					}
				?>
				<span class="eventDetails"><?php echo $startDate; ?> - <?php echo $endDate; ?> <?php echo ($city ? " - " . $city["name"] : ""); ?></span>
			</div>
		</div>
<?php endforeach; ?>